package com.s4j.core.common;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.s4j.core.datagrid.DatagridPaging;
import com.s4j.core.manager.model.SysModule;
import com.s4j.core.manager.module.listener.ModuleInitListener;


public class BaseAction implements ModuleInitListener {
	
	private DatagridPaging datagridPaging;
	
	private Map<String, Object> resultMap = new HashMap<String, Object>();
	
	private Integer page;
	
	private Integer rows;

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getRows() {
		return rows;
	}

	public void setRows(Integer rows) {
		this.rows = rows;
	}

	public Map<String, Object> getResultMap() {
		return resultMap;
	}

	public void setResultMap(Map<String, Object> resultMap) {
		this.resultMap = resultMap;
	}

	public DatagridPaging getDatagridPaging() {
		return datagridPaging;
	}

	public void setDatagridPaging(DatagridPaging datagridPaging) {
		this.datagridPaging = datagridPaging;
	}
	
	public void responseJson(HttpServletResponse resp, String jsonStr) {
		try {      
			resp.setContentType("text/html;charset=UTF-8");   
			resp.setHeader("Pragma", "No-cache");   
			resp.setHeader("Cache-Control", "no-cache");   
			resp.setDateHeader("Expires", 0);   
			resp.getWriter().write(jsonStr);   
			resp.getWriter().flush();   
		} catch (IOException e) {   
		    e.printStackTrace(); 
		}  
	}
	
	public void init(SysModule module ,HttpServletRequest request) {
		
	}
}
